//
//  StyledViewController.m
//  NewApp
//
//  Created by  on 12-7-2.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "StyledViewController.h"

@interface StyledViewController ()

@end

@implementation StyledViewController
@synthesize tableView = tableView_;
@synthesize galleryView = galleryView_;
@synthesize datasourceObjects = datasourceObjects_;
@synthesize currentStyle;

#pragma mark -
#pragma mark - Views lifecycle and memory management

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void) dealloc {
    [tableView_ release];
    [datasourceObjects_ release];
    [galleryView_ release];
    [currentStyle release];
    [super dealloc];
}

#pragma mark -
#pragma mark - Read only property accessories

- (UITableView *) tableView {
    if (nil == tableView_) {
        tableView_ = [[UITableView alloc] initWithFrame:CGRectMake(0.f, 25.f, 320.f, 367.f) 
                                                  style:UITableViewStylePlain];
        tableView_.dataSource = self;
        tableView_.delegate = self;
        tableView_.separatorStyle = UITableViewCellSeparatorStyleNone;
        tableView_.backgroundColor = [UIColor clearColor];

    }
    
    return tableView_;
}

- (NSMutableArray *) datasourceObjects {
    if (nil == datasourceObjects_) {
        datasourceObjects_ = [[NSMutableArray alloc] init];
    }
    
    return datasourceObjects_;
}

- (ThumbnailGalleryView *) galleryView {
    if (nil == galleryView_) {
        galleryView_ = [[ThumbnailGalleryView alloc] initWithFrame:CGRectMake(0, 26, 320, 480)];
    }
    
    return galleryView_;
}

#pragma mark - 
#pragma mark - Publics

- (Entity *) entityAtIndex:(NSInteger) index {
    if (index < 0 || index >= self.datasourceObjects.count) {
        return nil;
    }
    
    return [self.datasourceObjects objectAtIndex:index];
}



@end
